package com.gali.leetcode.day4;

/**
 * @Auther: gali
 * @Date: 2022/7/17-07-17-20:27
 * @Description:盛最多水的容器
 */
public class MaxArea {
    public int maxArea(int[] height) {
        int i=0,j=height.length-1,res=0;
        while (i<j){
            res=height[i]<height[j]?
                Math.max(res,(j-i)*height[i++]):
                Math.max(res,(j-i)*height[j--]);
        }
        return res;
    }
}
